# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html


import time

class WhiteAlbumScrapyPipeline(object):
    print '************************************'
    def process_item(self, item, spider):
        now = time.strftime('%Y-%m-%d', time.localtime())
        filename = 'white_album_spider' + now + '.txt'

        with open(filename, 'a') as fp:
            t = item['para'][0].encode('utf8')
            fp.write(t)
            fp.write('\n'.encode('utf8'))

        return item
